package com.zjitc.backend_shop.utils;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
public class APIResponse<T> {
    private Integer errno;
    private String errmsg;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private T data;
    public APIResponse() {
    }
    public APIResponse(Integer errno, String errmsg, T data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }
    public void APIResponseOK(int errno,String errmsg,T data) {
        this.errno = 0;
        this.errmsg = errmsg;
        this.data = data;
    }
    public void APIResponseError(int errno,String errmsg,T data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }
}

